package cn.xiaoyu.su.service;

import cn.xiaoyu.su.controller.request.ShortLinkAddRequest;
import cn.xiaoyu.su.controller.request.ShortLinkDelRequest;
import cn.xiaoyu.su.controller.request.ShortLinkPageRequest;
import cn.xiaoyu.su.controller.request.ShortLinkUpdateRequest;
import cn.xiaoyu.su.model.EventMessage;
import cn.xiaoyu.su.util.JsonData;
import cn.xiaoyu.su.vo.ShortLinkVO;

import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author ⼆当家⼩D
 * @since 2022-12-03
 */
public interface ShortLinkService {

    /**
     * 解析短链
     * @param shortLinkCode
     * @return
     */
    ShortLinkVO parseShortLinkCode(String shortLinkCode);

    /**
     * 创建短链
     * @param shortLinkAddRequest
     * @return
     */
    JsonData createShortLink(ShortLinkAddRequest shortLinkAddRequest);


    /**
     * 分页查询短链
     * @param pageRequest
     * @return
     */
    Map<String, Object> pageByGroupId(ShortLinkPageRequest pageRequest);

    /**
     * 删除短链
     * @param request
     * @return
     */
    JsonData del(ShortLinkDelRequest request);

    /**
     * 更新短链
     * @param request
     * @return
     */
    JsonData update(ShortLinkUpdateRequest request);

    /**
     * 处理新增短链消息
     * @param eventMessage
     * @return
     */
    boolean handleAddShortLink(EventMessage eventMessage);

    /**
     * 处理更新短链消息
     * @param eventMessage
     * @return
     */
    boolean handleUpdateShortLink(EventMessage eventMessage);

    /**
     * 处理删除短链消息
     * @param eventMessage
     * @return
     */
    boolean handleDelShortLink(EventMessage eventMessage);
}
